package com.joker.demo.admin.domain.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 环境监控数据PO
 *
 * @author : feixiang.li
 * @since : 2025-01-27 10:30
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_job_environment_monitor")
public class EnvironmentMonitorPO extends BaseEntity {

    /**
     * 主键ID
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 执行器注册键
     */
    private String registerKey;

    /**
     * 应用名称
     */
    private String appName;

    /**
     * 监控时间
     */
    private LocalDateTime monitorTime;

    /**
     * 操作系统名称
     */
    private String osName;

    /**
     * 操作系统版本
     */
    private String osVersion;

    /**
     * 系统架构
     */
    private String osArch;

    /**
     * CPU核心数
     */
    private Integer cpuCores;

    /**
     * CPU使用率
     */
    private BigDecimal cpuUsagePercent;

    /**
     * 系统总内存(MB)
     */
    @TableField(value = "total_memory_mb")
    private Long totalMemoryMB;

    /**
     * 系统已用内存(MB)
     */
    @TableField(value = "used_memory_mb")
    private Long usedMemoryMB;

    /**
     * 系统空闲内存(MB)
     */
    @TableField(value = "free_memory_mb")
    private Long freeMemoryMB;

    /**
     * 系统内存使用率
     */
    private BigDecimal systemMemoryUsagePercent;

    /**
     * 系统负载平均值
     */
    private BigDecimal systemLoadAverage;

    /**
     * 系统运行时间(秒)
     */
    private Long uptimeSeconds;

    /**
     * JVM版本
     */
    private String jvmVersion;

    /**
     * JVM供应商
     */
    private String jvmVendor;

    /**
     * JVM名称
     */
    private String jvmName;

    /**
     * JVM启动时间
     */
    private Long jvmStartTime;

    /**
     * JVM运行时间(毫秒)
     */
    @TableField(value = "jvm_uptime")
    private Long jvmUptime;

    /**
     * 最大堆内存(MB)
     */
    @TableField(value = "max_heap_memory_mb")
    private Long maxHeapMemoryMB;

    /**
     * 已用堆内存(MB)
     */
    @TableField(value = "used_heap_memory_mb")
    private Long usedHeapMemoryMB;

    /**
     * 空闲堆内存(MB)
     */
    @TableField(value = "free_heap_memory_mb")
    private Long freeHeapMemoryMB;

    /**
     * 堆内存使用率
     */
    private BigDecimal heapMemoryUsagePercent;

    /**
     * 最大非堆内存(MB)
     */
    @TableField(value = "max_non_heap_memory_mb")
    private Long maxNonHeapMemoryMB;

    /**
     * 已用非堆内存(MB)
     */
    @TableField(value = "used_non_heap_memory_mb")
    private Long usedNonHeapMemoryMB;

    /**
     * 非堆内存使用率
     */
    private BigDecimal nonHeapMemoryUsagePercent;

    /**
     * 线程总数
     */
    private Integer threadCount;

    /**
     * 守护线程数
     */
    private Integer daemonThreadCount;

    /**
     * 峰值线程数
     */
    private Integer peakThreadCount;

    /**
     * 类加载器数量
     */
    private Integer classLoaderCount;

    /**
     * 已加载类数量
     */
    private Long loadedClassCount;

    /**
     * 总加载类数量
     */
    private Long totalLoadedClassCount;

    /**
     * 已卸载类数量
     */
    private Long unloadedClassCount;

    /**
     * 磁盘信息JSON
     */
    private String diskInfosJson;

    /**
     * 网络信息JSON
     */
    private String networkInfoJson;

    /**
     * GC信息JSON
     */
    private String gcInfosJson;

    /**
     * 进程ID
     */
    private Long processId;

    /**
     * 进程名称
     */
    private String processName;

    /**
     * 进程CPU使用率
     */
    private BigDecimal processCpuUsagePercent;

    /**
     * 进程内存使用(MB)
     */
    @TableField(value = "process_memory_usage_mb")
    private Long processMemoryUsageMB;

    /**
     * 进程线程数
     */
    private Integer processThreadCount;

    /**
     * 进程打开文件数
     */
    private Long openFileCount;

    /**
     * 进程优先级
     */
    private Integer processPriority;

    // ========== 新增字段 ==========

    /**
     * 系统内存总量(MB) - 用于Mapper查询
     */
    @TableField(value = "system_memory_total_mb")
    private Long systemMemoryTotalMB;

    /**
     * 系统内存已用量(MB) - 用于Mapper查询
     */
    @TableField(value = "system_memory_used_mb")
    private Long systemMemoryUsedMB;

    /**
     * 系统内存空闲量(MB) - 用于Mapper查询
     */
    @TableField(value = "system_memory_free_mb")
    private Long systemMemoryFreeMB;

    /**
     * 堆内存总量(MB) - 用于Mapper查询
     */
    @TableField(value = "heap_memory_total_mb")
    private Long heapMemoryTotalMB;

    /**
     * 堆内存已用量(MB) - 用于Mapper查询
     */
    @TableField(value = "heap_memory_used_mb")
    private Long heapMemoryUsedMB;

    /**
     * 堆内存空闲量(MB) - 用于Mapper查询
     */
    @TableField(value = "heap_memory_free_mb")
    private Long heapMemoryFreeMB;

    /**
     * 非堆内存总量(MB) - 用于Mapper查询
     */
    @TableField(value = "non_heap_memory_total_mb")
    private Long nonHeapMemoryTotalMB;

    /**
     * 非堆内存已用量(MB) - 用于Mapper查询
     */
    @TableField(value = "non_heap_memory_used_mb")
    private Long nonHeapMemoryUsedMB;

    /**
     * 非堆内存空闲量(MB) - 用于Mapper查询
     */
    @TableField(value = "non_heap_memory_free_mb")
    private Long nonHeapMemoryFreeMB;

    /**
     * 死锁线程数
     */
    private Integer deadlockedThreadCount;

    /**
     * 死锁监视器线程数
     */
    private Integer deadlockedMonitorThreadCount;

    /**
     * 磁盘使用率
     */
    private BigDecimal diskUsagePercent;

    /**
     * 磁盘总容量(GB)
     */
    @TableField(value = "disk_total_gb")
    private BigDecimal diskTotalGB;

    /**
     * 磁盘已用量(GB)
     */
    @TableField(value = "disk_used_gb")
    private BigDecimal diskUsedGB;

    /**
     * 磁盘空闲量(GB)
     */
    @TableField(value = "disk_free_gb")
    private BigDecimal diskFreeGB;

    /**
     * 网络接收字节数/秒
     */
    private Long networkReceiveBytesPerSec;

    /**
     * 网络发送字节数/秒
     */
    private Long networkSendBytesPerSec;
}
